﻿using Md.Api.Model;
using Md.Api.Model.Web.SysDict.Request;
using Md.Api.Service.Web.SysDict;
using Microsoft.AspNetCore.Mvc;

namespace Md.Api.Controllers.Web;
/// <summary>
/// PC系统字段管理
/// </summary>
[ApiController]
[Produces("application/json")]
[Route("md-api/web/sysDict")]
public class SysDictWebController : ControllerBase
{
    /// <summary>
    /// 通过字典类型获取字典数据列表服务
    /// </summary>
    public GetSysDictDataListByDictTypeWebService getSysDictDataListByDictTypeWebService { get; set; }
    /// <summary>
    /// 通过字典类型获取字典数据列表
    /// </summary>
    /// <param name="dictType">字典类型</param>
    /// <param name="signModel">加密实体</param>
    /// <returns>ResponseMessageModel</returns>
    [Route("type/{dictType}"), HttpGet]
    public async Task<ResponseMessageModel> GetSysDictDataListByDictTypeWeb(string dictType, [FromQuery] RequestSignModel signModel)
    {
        var model = new RequestGetSysDictDataListByDictTypeWebModel();

        model.DictType = dictType;
        model.TimesTamp = signModel.TimesTamp;
        model.Mac = signModel.Mac;
        model.Ip = signModel.Ip;
        model.Sign = signModel.Sign;
        model.Version = signModel.Version;
        model.Token = signModel.Token;

        return await Task.Run(() => getSysDictDataListByDictTypeWebService.Execute(model));
    }
}

